package frame.options.simulation.create.backup;

import com.nexes.wizard.WizardPanelDescriptor;

import frame.options.simulation.create.CreateSimulationWizard;
import frame.options.simulation.create.splitting.SplittingDescriptor;
import frame.options.simulation.create.virtual.VirtualDescriptor;

public class BackupDescriptor extends WizardPanelDescriptor
{
	public static final String IDENTIFIER = BackupDescriptor.class.getSimpleName();
	
	private BackupPanel backupPanel;
	public BackupPanel getBackupPanel(){ return backupPanel; }
	public void setBackupPanel( BackupPanel backupPanel ){ this.backupPanel = backupPanel; }
	
	public BackupDescriptor()
    {
		this.setBackupPanel( new BackupPanel() );
		
		this.setPanelDescriptorIdentifier( BackupDescriptor.IDENTIFIER );
    	this.setPanelComponent( this.getBackupPanel() );
    }
    
    @Override
	public Object getBackPanelDescriptor()
    {
    	return VirtualDescriptor.IDENTIFIER;
    }
    
    @Override
	public Object getNextPanelDescriptor()
    {
    	if( this.getBackupPanel().getNoRadioButton().isSelected() )
    		( (CreateSimulationWizard) this.getWizard() ).setBackup( false );
    	
    	else if( this.getBackupPanel().getYesRadioButton().isSelected() )
    		( (CreateSimulationWizard) this.getWizard() ).setBackup( true );
    	
    	return SplittingDescriptor.IDENTIFIER;
    }
    
    @Override
	public void aboutToDisplayPanel()
    {
    	this.getWizard().setNextFinishButtonEnabled( true );
    }
    
	public void aboutToHidePanel(){ }
    
}
